home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / VBASIC / T2WIN-32.ZIP / _ARRAY.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1997-01-01  |  25.6 KB  |  772 lines

  1. VERSION 4.00
  2. Begin VB.Form frmArray 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Array"
  5.    ClientHeight    =   4170
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   6690
  9.    Height          =   4575
  10.    Left            =   1830
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4170
  14.    ScaleWidth      =   6690
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   2925
  17.    Width           =   6810
  18.    Begin VB.ListBox List2 
  19.       Height          =   2010
  20.       Left            =   3510
  21.       TabIndex        =   2
  22.       Top             =   2070
  23.       Width           =   3075
  24.    End
  25.    Begin VB.ListBox List1 
  26.       Height          =   2010
  27.       Left            =   90
  28.       TabIndex        =   1
  29.       Top             =   2070
  30.       Width           =   3075
  31.    End
  32.    Begin Threed.SSPanel SSPanel1 
  33.       Align           =   1  'Align Top
  34.       Height          =   480
  35.       Left            =   0
  36.       TabIndex        =   3
  37.       Top             =   0
  38.       Width           =   6690
  39.       _Version        =   65536
  40.       _ExtentX        =   11800
  41.       _ExtentY        =   847
  42.       _StockProps     =   15
  43.       ForeColor       =   -2147483640
  44.       BackColor       =   12632256
  45.       Begin VB.ComboBox cmb_Function 
  46.          Height          =   315
  47.          Left            =   1365
  48.          TabIndex        =   4
  49.          Top             =   90
  50.          Width           =   3945
  51.       End
  52.       Begin Threed.SSCommand cmdNP 
  53.          Height          =   300
  54.          Index           =   1
  55.          Left            =   6300
  56.          TabIndex        =   8
  57.          Top             =   90
  58.          Width           =   255
  59.          _Version        =   65536
  60.          _ExtentX        =   450
  61.          _ExtentY        =   529
  62.          _StockProps     =   78
  63.          Caption         =   ">"
  64.          BevelWidth      =   1
  65.          Font3D          =   3
  66.          RoundedCorners  =   0   'False
  67.          Outline         =   0   'False
  68.       End
  69.       Begin Threed.SSCommand cmdNP 
  70.          Height          =   300
  71.          Index           =   0
  72.          Left            =   5460
  73.          TabIndex        =   7
  74.          Top             =   90
  75.          Width           =   255
  76.          _Version        =   65536
  77.          _ExtentX        =   450
  78.          _ExtentY        =   529
  79.          _StockProps     =   78
  80.          Caption         =   "<"
  81.          BevelWidth      =   1
  82.          Font3D          =   3
  83.          RoundedCorners  =   0   'False
  84.          Outline         =   0   'False
  85.       End
  86.       Begin VB.Label Label2 
  87.          Caption         =   "&Select a function"
  88.          Height          =   255
  89.          Left            =   90
  90.          TabIndex        =   6
  91.          Top             =   120
  92.          Width           =   1275
  93.       End
  94.       Begin Threed.SSCommand SSCommand1 
  95.          Default         =   -1  'True
  96.          Height          =   300
  97.          Left            =   5775
  98.          TabIndex        =   5
  99.          Top             =   90
  100.          Width           =   465
  101.          _Version        =   65536
  102.          _ExtentX        =   820
  103.          _ExtentY        =   529
  104.          _StockProps     =   78
  105.          Caption         =   "&Go"
  106.          BevelWidth      =   1
  107.          RoundedCorners  =   0   'False
  108.          Outline         =   0   'False
  109.       End
  110.    End
  111.    Begin VB.Label lbl_Result 
  112.       Appearance      =   0  'Flat
  113.       BackColor       =   &H00C0C0C0&
  114.       ForeColor       =   &H80000008&
  115.       Height          =   1275
  116.       Left            =   105
  117.       TabIndex        =   0
  118.       Top             =   630
  119.       Width           =   6495
  120.    End
  121. Attribute VB_Name = "frmArray"
  122. Attribute VB_Creatable = False
  123. Attribute VB_Exposed = False
  124. Option Explicit
  125. Option Base 1
  126. Private Const Iteration = 250
  127. Private Const arrSize = 10
  128. Dim IsLoaded         As Integer
  129. Dim TimerStartOk     As Integer
  130. Dim TimerCloseOk     As Integer
  131. Dim TimerHandle      As Integer
  132. Dim TimerValue       As Long
  133. Private Sub TestAdd()
  134.    Dim intResult        As Integer
  135.    Dim strDisplay       As String
  136.    Dim intLB            As Integer
  137.    Dim intUB            As Integer
  138.    Dim intTotalElement  As Integer
  139.    Dim i                As Integer
  140.    intResult = False
  141.    strDisplay = ""
  142.    ReDim array(arrSize) As Integer
  143.    Randomize Timer
  144.    intLB = LBound(array)
  145.    intUB = UBound(array)
  146.    intTotalElement = intUB - intLB + 1
  147.       
  148.    For i = intLB To intUB
  149.       array(i) = RandI * Rnd(1)
  150.       List1.AddItem "" & array(i)
  151.    Next i
  152.    intResult = cAddI(array(), 10)
  153.    For i = intLB To intUB
  154.       List2.AddItem "" & array(i)
  155.    Next i
  156.    strDisplay = strDisplay & "Add 10 to element " & intLB & " of an integer array is : " & array(intLB) & vbCrLf & vbCrLf
  157.    strDisplay = strDisplay & "Add 10 to element " & intUB & " of an integer array is : " & array(intUB)
  158.    lbl_Result = strDisplay
  159.    'time the function
  160.    TimerHandle = cTimerOpen()
  161.    TimerStartOk = cTimerStart(TimerHandle)
  162.    For i = 1 To Iteration
  163.       intResult = cAddI(array(), 1)
  164.    Next i
  165.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  166.    TimerCloseOk = cTimerClose(TimerHandle)
  167. End Sub
  168. Private Sub cmb_Function_Click()
  169.    If (IsLoaded = False) Then Exit Sub
  170.    Call cDisableFI(mdiT2W.Picture1)
  171.    List1.Visible = True
  172.    List2.Visible = True
  173.    List1.Clear
  174.    List2.Clear
  175.    lbl_Result = ""
  176.    DoEvents
  177.    Select Case cmb_Function.ListIndex
  178.       Case 0
  179.          Call TestAdd
  180.       Case 1
  181.          List2.Visible = False
  182.          Call TestCount
  183.       Case 2
  184.          List2.Visible = False
  185.          Call TestDeviation
  186.       Case 3
  187.          Call TestFill
  188.       Case 4
  189.          Call TestFillIncr
  190.       Case 5
  191.          Call TestMax
  192.       Case 6
  193.          List2.Visible = False
  194.          Call TestMean
  195.       Case 7
  196.          Call TestMin
  197.       Case 8
  198.          Call TestReverseSort
  199.       Case 9
  200.          Call TestSearch
  201.       Case 10
  202.          Call TestSet
  203.       Case 11
  204.          Call TestSort
  205.       Case 12
  206.          List2.Visible = False
  207.          Call TestSum
  208.       Case 13
  209.          Call TestArrayOnDisk
  210.       Case 14
  211.          Call TestMaxNotX
  212.       Case 15
  213.          Call TestMinNotX
  214.    End Select
  215.    DoEvents
  216.    Call cEnableFI(mdiT2W.Picture1)
  217. End Sub
  218. Private Sub cmdNP_Click(Index As Integer)
  219.    Call sub_NextPrev(cmb_Function, Index)
  220. End Sub
  221. Private Sub Form_Activate()
  222.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  223. End Sub
  224. Private Sub Form_Load()
  225.    IsLoaded = False
  226.    Show
  227.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_array.t2w")
  228.    IsLoaded = True
  229. End Sub
  230. Private Sub TestDeviation()
  231.    Dim dblResult        As Double
  232.    Dim strDisplay       As String
  233.    Dim intLB            As Integer
  234.    Dim intUB            As Integer
  235.    Dim intTotalElement  As Integer
  236.    Dim i                As Integer
  237.    Dim dblMean          As Double
  238.    Dim dblDeviation     As Double
  239.    dblResult = 0
  240.    strDisplay = ""
  241.    dblMean = 0
  242.    dblDeviation = 0
  243.    ReDim array(arrSize) As Integer
  244.    Randomize Timer
  245.    intLB = LBound(array)
  246.    intUB = UBound(array)
  247.    intTotalElement = intUB - intLB + 1
  248.       
  249.    For i = intLB To intUB
  250.       array(i) = Int(RandI * Rnd(1))
  251.       dblMean = dblMean + array(i)
  252.       List1.AddItem "" & array(i)
  253.    Next i
  254.    dblMean = dblMean / (intTotalElement)
  255.    For i = intLB To intUB
  256.       dblDeviation = dblDeviation + ((array(i) - dblMean) * (array(i) - dblMean))
  257.    Next i
  258.    dblDeviation = (Sqr(dblDeviation) / (intTotalElement))
  259.    dblResult = cDeviationI(array())
  260.    strDisplay = "The Deviation of a integer array of " & (intTotalElement) & " elements is " & vbCrLf & vbCrLf & dblResult & " (" & dblDeviation & ")"
  261.    lbl_Result = strDisplay
  262.    'time the function
  263.    TimerHandle = cTimerOpen()
  264.    TimerStartOk = cTimerStart(TimerHandle)
  265.    For i = 1 To Iteration
  266.       dblResult = cDeviationI(array())
  267.    Next i
  268.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  269.    TimerCloseOk = cTimerClose(TimerHandle)
  270. End Sub
  271. Private Sub TestFill()
  272.    Dim intResult        As Integer
  273.    Dim strDisplay       As String
  274.    Dim intLB            As Integer
  275.    Dim intUB            As Integer
  276.    Dim intTotalElement  As Integer
  277.    Dim i                As Integer
  278.    intResult = False
  279.    strDisplay = ""
  280.    ReDim array(arrSize) As Integer
  281.    Randomize Timer
  282.    intLB = LBound(array)
  283.    intUB = UBound(array)
  284.    intTotalElement = intUB - intLB + 1
  285.       
  286.    For i = intLB To intUB
  287.       array(i) = RandI * Rnd(1)
  288.       List1.AddItem "" & array(i)
  289.    Next i
  290.    intResult = cFillI(array(), 5)
  291.    For i = intLB To intUB
  292.       List2.AddItem "" & array(i)
  293.    Next i
  294.    strDisplay = strDisplay & "Fill 1 to element " & intLB & " of an integer array is : " & array(intLB) & vbCrLf & vbCrLf
  295.    strDisplay = strDisplay & "Fill 1 to element " & intUB & " of an integer array is : " & array(intUB)
  296.    lbl_Result = strDisplay
  297.    'time the function
  298.    TimerHandle = cTimerOpen()
  299.    TimerStartOk = cTimerStart(TimerHandle)
  300.    For i = 1 To Iteration
  301.       intResult = cFillI(array(), 1)
  302.    Next i
  303.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  304.    TimerCloseOk = cTimerClose(TimerHandle)
  305. End Sub
  306. Private Sub TestFillIncr()
  307.    Dim intResult        As Integer
  308.    Dim strDisplay       As String
  309.    Dim intLB            As Integer
  310.    Dim intUB            As Integer
  311.    Dim intTotalElement  As Integer
  312.    Dim i                As Integer
  313.    intResult = False
  314.    strDisplay = ""
  315.    ReDim array(arrSize) As Integer
  316.    Randomize Timer
  317.    intLB = LBound(array)
  318.    intUB = UBound(array)
  319.    intTotalElement = intUB - intLB + 1
  320.       
  321.    For i = intLB To intUB
  322.       array(i) = RandI * Rnd(1)
  323.       List1.AddItem "" & array(i)
  324.    Next i
  325.    intResult = cFillIncrI(array(), -2, 3)
  326.    For i = intLB To intUB
  327.       List2.AddItem "" & array(i)
  328.    Next i
  329.    strDisplay = strDisplay & "Fill -2 by increment 3 to element " & intLB & " of an integer array is : " & array(intLB) & vbCrLf & vbCrLf
  330.    strDisplay = strDisplay & "Fill -2 by increment 3 to element " & intUB & " of an integer array is : " & array(intUB)
  331.    lbl_Result = strDisplay
  332.    'time the function
  333.    TimerHandle = cTimerOpen()
  334.    TimerStartOk = cTimerStart(TimerHandle)
  335.    For i = 1 To Iteration
  336.       intResult = cFillIncrI(array(), -2, 3)
  337.    Next i
  338.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  339.    TimerCloseOk = cTimerClose(TimerHandle)
  340. End Sub
  341. Private Sub TestMax()
  342.    Dim intResult        As Integer
  343.    Dim strDisplay       As String
  344.    Dim intLB            As Integer
  345.    Dim intUB            As Integer
  346.    Dim intTotalElement  As Integer
  347.    Dim i                As Integer
  348.    intResult = False
  349.    strDisplay = ""
  350.    ReDim array(arrSize) As Integer
  351.    Randomize Timer
  352.    intLB = LBound(array)
  353.    intUB = UBound(array)
  354.    intTotalElement = intUB - intLB + 1
  355.       
  356.    For i = intLB To intUB
  357.       array(i) = RandI * Rnd(1)
  358.       List1.AddItem "" & array(i)
  359.    Next i
  360.    intResult = cSortI(array())
  361.    For i = intLB To intUB
  362.       List2.AddItem "" & array(i)
  363.    Next i
  364.    intResult = cMaxI(array())
  365.    strDisplay = strDisplay & "The Max of this integer array is : " & intResult
  366.    lbl_Result = strDisplay
  367.    'time the function
  368.    TimerHandle = cTimerOpen()
  369.    TimerStartOk = cTimerStart(TimerHandle)
  370.    For i = 1 To Iteration
  371.       intResult = cMaxI(array())
  372.    Next i
  373.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  374.    TimerCloseOk = cTimerClose(TimerHandle)
  375. End Sub
  376. Private Sub TestMin()
  377.    Dim intResult        As Integer
  378.    Dim strDisplay       As String
  379.    Dim intLB            As Integer
  380.    Dim intUB            As Integer
  381.    Dim intTotalElement  As Integer
  382.    Dim i                As Integer
  383.    intResult = False
  384.    strDisplay = ""
  385.    ReDim array(arrSize) As Integer
  386.    Randomize Timer
  387.    intLB = LBound(array)
  388.    intUB = UBound(array)
  389.    intTotalElement = intUB - intLB + 1
  390.       
  391.    For i = intLB To intUB
  392.       array(i) = RandI * Rnd(1)
  393.       List1.AddItem "" & array(i)
  394.    Next i
  395.    intResult = cSortI(array())
  396.    For i = intLB To intUB
  397.       List2.AddItem "" & array(i)
  398.    Next i
  399.    intResult = cMinI(array())
  400.    strDisplay = strDisplay & "The Min of this integer array is : " & intResult
  401.    lbl_Result = strDisplay
  402.    'time the function
  403.    TimerHandle = cTimerOpen()
  404.    TimerStartOk = cTimerStart(TimerHandle)
  405.    For i = 1 To Iteration
  406.       intResult = cMinI(array())
  407.    Next i
  408.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  409.    TimerCloseOk = cTimerClose(TimerHandle)
  410. End Sub
  411. Private Sub TestMean()
  412.    Dim dblResult        As Double
  413.    Dim strDisplay       As String
  414.    Dim intLB            As Integer
  415.    Dim intUB            As Integer
  416.    Dim intTotalElement  As Integer
  417.    Dim i                As Integer
  418.    Dim dblMean          As Double
  419.    dblResult = 0
  420.    strDisplay = ""
  421.    dblMean = 0
  422.    dblMean = 0
  423.    ReDim array(arrSize) As Integer
  424.    Randomize Timer
  425.    intLB = LBound(array)
  426.    intUB = UBound(array)
  427.    intTotalElement = intUB - intLB + 1
  428.       
  429.    For i = intLB To intUB
  430.       array(i) = Int(RandI * Rnd(1))
  431.       dblMean = dblMean + array(i)
  432.       List1.AddItem "" & array(i)
  433.    Next i
  434.    dblMean = dblMean / (intTotalElement)
  435.    dblResult = cMeanI(array())
  436.    strDisplay = "The Mean of this integer array of " & (intTotalElement) & " elements is " & vbCrLf & vbCrLf & dblResult & " (" & dblMean & ")"
  437.    lbl_Result = strDisplay
  438.    'time the function
  439.    TimerHandle = cTimerOpen()
  440.    TimerStartOk = cTimerStart(TimerHandle)
  441.    For i = 1 To Iteration
  442.       dblResult = cMeanI(array())
  443.    Next i
  444.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  445.    TimerCloseOk = cTimerClose(TimerHandle)
  446. End Sub
  447. Private Sub TestReverseSort()
  448.    Dim intResult        As Integer
  449.    Dim strDisplay       As String
  450.    Dim intLB            As Integer
  451.    Dim intUB            As Integer
  452.    Dim intTotalElement  As Integer
  453.    Dim i                As Integer
  454.    intResult = False
  455.    strDisplay = ""
  456.    ReDim array(arrSize) As Integer
  457.    Randomize Timer
  458.    intLB = LBound(array)
  459.    intUB = UBound(array)
  460.    intTotalElement = intUB - intLB + 1
  461.       
  462.    For i = intLB To intUB
  463.       array(i) = RandI * Rnd(1)
  464.       List1.AddItem "" & array(i)
  465.    Next i
  466.    intResult = cReverseSortI(array())
  467.    For i = intLB To intUB
  468.       List2.AddItem "" & array(i)
  469.    Next i
  470.    lbl_Result = strDisplay
  471.    'time the function
  472.    TimerHandle = cTimerOpen()
  473.    TimerStartOk = cTimerStart(TimerHandle)
  474.    For i = 1 To Iteration
  475.       intResult = cReverseSortI(array())
  476.    Next i
  477.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  478.    TimerCloseOk = cTimerClose(TimerHandle)
  479. End Sub
  480. Private Sub TestSet()
  481.    Dim intResult        As Integer
  482.    Dim strDisplay       As String
  483.    Dim intLB            As Integer
  484.    Dim intUB            As Integer
  485.    Dim intTotalElement  As Integer
  486.    Dim i                As Integer
  487.    intResult = False
  488.    strDisplay = ""
  489.    ReDim array(arrSize) As Integer
  490.    Randomize Timer
  491.    intLB = LBound(array)
  492.    intUB = UBound(array)
  493.    intTotalElement = intUB - intLB + 1
  494.       
  495.    For i = intLB To intUB
  496.       array(i) = RandI * Rnd(1)
  497.       List1.AddItem "" & array(i)
  498.    Next i
  499.    intResult = cSetI(array(), 1024)
  500.    For i = intLB To intUB
  501.       List2.AddItem "" & array(i)
  502.    Next i
  503.    strDisplay = strDisplay & "Set 1024 to element " & intLB & " of an integer array is : " & array(intLB) & vbCrLf & vbCrLf
  504.    strDisplay = strDisplay & "Set 1024 to element " & intUB & " of an integer array is : " & array(intUB)
  505.    lbl_Result = strDisplay
  506.    'time the function
  507.    TimerHandle = cTimerOpen()
  508.    TimerStartOk = cTimerStart(TimerHandle)
  509.    For i = 1 To Iteration
  510.       intResult = cSetI(array(), 1)
  511.    Next i
  512.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  513.    TimerCloseOk = cTimerClose(TimerHandle)
  514. End Sub
  515. Private Sub TestSort()
  516.    Dim intResult        As Integer
  517.    Dim strDisplay       As String
  518.    Dim intLB            As Integer
  519.    Dim intUB            As Integer
  520.    Dim intTotalElement  As Integer
  521.    Dim i                As Integer
  522.    intResult = False
  523.    strDisplay = ""
  524.    ReDim array(arrSize) As Integer
  525.    Randomize Timer
  526.    intLB = LBound(array)
  527.    intUB = UBound(array)
  528.    intTotalElement = intUB - intLB + 1
  529.       
  530.    For i = intLB To intUB
  531.       array(i) = RandI * Rnd(1)
  532.       List1.AddItem "" & array(i)
  533.    Next i
  534.    intResult = cSortI(array())
  535.    For i = intLB To intUB
  536.       List2.AddItem "" & array(i)
  537.    Next i
  538.    lbl_Result = strDisplay
  539.    'time the function
  540.    TimerHandle = cTimerOpen()
  541.    TimerStartOk = cTimerStart(TimerHandle)
  542.    For i = 1 To Iteration
  543.       intResult = cSortI(array())
  544.    Next i
  545.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  546.    TimerCloseOk = cTimerClose(TimerHandle)
  547. End Sub
  548. Private Sub TestSum()
  549.    Dim dblResult        As Double
  550.    Dim strDisplay       As String
  551.    Dim intLB            As Integer
  552.    Dim intUB            As Integer
  553.    Dim intTotalElement  As Integer
  554.    Dim i                As Integer
  555.    Dim dblSum           As Double
  556.    dblResult = 0
  557.    strDisplay = ""
  558.    dblSum = 0
  559.    dblSum = 0
  560.    ReDim array(arrSize) As Integer
  561.    Randomize Timer
  562.    intLB = LBound(array)
  563.    intUB = UBound(array)
  564.    intTotalElement = intUB - intLB + 1
  565.       
  566.    For i = intLB To intUB
  567.       array(i) = Int(RandI * Rnd(1))
  568.       dblSum = dblSum + array(i)
  569.       List1.AddItem "" & array(i)
  570.    Next i
  571.    dblResult = cSumI(array())
  572.    strDisplay = "The Sum of this integer array of " & (intTotalElement) & " elements is " & vbCrLf & vbCrLf & dblResult & " (" & dblSum & ")"
  573.    lbl_Result = strDisplay
  574.    'time the function
  575.    TimerHandle = cTimerOpen()
  576.    TimerStartOk = cTimerStart(TimerHandle)
  577.    For i = 1 To Iteration
  578.       dblResult = cSumI(array())
  579.    Next i
  580.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  581.    TimerCloseOk = cTimerClose(TimerHandle)
  582. End Sub
  583. Private Sub TestCount()
  584.    Dim intResult        As Integer
  585.    Dim strDisplay       As String
  586.    Dim intLB            As Integer
  587.    Dim intUB            As Integer
  588.    Dim intTotalElement  As Integer
  589.    Dim i                As Integer
  590.    intResult = False
  591.    strDisplay = ""
  592.    ReDim array(arrSize) As Integer
  593.    Randomize Timer
  594.    intLB = LBound(array)
  595.    intUB = UBound(array)
  596.    intTotalElement = intUB - intLB + 1
  597.       
  598.    For i = intLB To intUB
  599.       array(i) = RandI * Rnd(1)
  600.       List1.AddItem "" & array(i)
  601.    Next i
  602.    strDisplay = strDisplay & "Count '" & array(1) & "' is " & cCountI(array(), array(1)) & vbCrLf
  603.    strDisplay = strDisplay & "Count '" & array(3) & "' is " & cCountI(array(), array(3)) & vbCrLf
  604.    strDisplay = strDisplay & "Count '" & array(5) & "' is " & cCountI(array(), array(5)) & vbCrLf
  605.    strDisplay = strDisplay & "Count '" & array(7) & "' is " & cCountI(array(), array(7)) & vbCrLf
  606.    strDisplay = strDisplay & "Count '" & array(9) & "' is " & cCountI(array(), array(9)) & vbCrLf
  607.    strDisplay = strDisplay & "Count '" & -1234 & "' is " & cCountI(array(), -1234)
  608.    lbl_Result = strDisplay
  609.    'time the function
  610.    TimerHandle = cTimerOpen()
  611.    TimerStartOk = cTimerStart(TimerHandle)
  612.    For i = 1 To Iteration
  613.       intResult = cCountI(array(), array(intLB))
  614.    Next i
  615.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  616.    TimerCloseOk = cTimerClose(TimerHandle)
  617. End Sub
  618. Private Sub TestSearch()
  619.    Dim intResult        As Integer
  620.    Dim strDisplay       As String
  621.    Dim intLB            As Integer
  622.    Dim intUB            As Integer
  623.    Dim intTotalElement  As Integer
  624.    Dim i                As Integer
  625.    intResult = False
  626.    strDisplay = ""
  627.    ReDim array(arrSize) As Integer
  628.    Randomize Timer
  629.    intLB = LBound(array)
  630.    intUB = UBound(array)
  631.    intTotalElement = intUB - intLB + 1
  632.       
  633.    For i = intLB To intUB
  634.       array(i) = RandI * Rnd(1)
  635.       List1.AddItem "" & array(i)
  636.    Next i
  637.    strDisplay = strDisplay & "Search '" & array(1) & "' is " & cSearchI(array(), array(1)) & vbCrLf
  638.    strDisplay = strDisplay & "Search '" & array(3) & "' is " & cSearchI(array(), array(3)) & vbCrLf
  639.    strDisplay = strDisplay & "Search '" & array(5) & "' is " & cSearchI(array(), array(5)) & vbCrLf
  640.    strDisplay = strDisplay & "Search '" & array(7) & "' is " & cSearchI(array(), array(7)) & vbCrLf
  641.    strDisplay = strDisplay & "Search '" & array(9) & "' is " & cSearchI(array(), array(9)) & vbCrLf
  642.    strDisplay = strDisplay & "Search '" & -1234 & "' is " & cSearchI(array(), -1234)
  643.    lbl_Result = strDisplay
  644.    'time the function
  645.    TimerHandle = cTimerOpen()
  646.    TimerStartOk = cTimerStart(TimerHandle)
  647.    For i = 1 To Iteration
  648.       intResult = cSearchI(array(), array(intLB))
  649.    Next i
  650.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  651.    TimerCloseOk = cTimerClose(TimerHandle)
  652. End Sub
  653. Private Sub SSCommand1_Click()
  654.    Call cmb_Function_Click
  655. End Sub
  656. Private Sub TestArrayOnDisk()
  657.    Dim intResult        As Integer
  658.    Dim strDisplay       As String
  659.    Dim intLB            As Integer
  660.    Dim intUB            As Integer
  661.    Dim intTotalElement  As Integer
  662.    Dim i                As Integer
  663.    intResult = False
  664.    strDisplay = ""
  665.    ReDim array(arrSize) As Integer
  666.    Randomize Timer
  667.    intLB = LBound(array)
  668.    intUB = UBound(array)
  669.    intTotalElement = intUB - intLB + 1
  670.       
  671.    For i = intLB To intUB
  672.       array(i) = RandI * Rnd(1)
  673.       List1.AddItem "" & array(i)
  674.    Next i
  675.    intResult = cArrayOnDisk("c:\test.dat", array(), PUT_ARRAY_ON_DISK)
  676.    strDisplay = strDisplay & "Save this integer array on disk is '" & intResult & "'" & vbCrLf & vbCrLf
  677.    DoEvents
  678.    intResult = cSetI(array(), 0)
  679.    strDisplay = strDisplay & "Set all element of this integer to 0 array is '" & intResult & "'" & vbCrLf & vbCrLf
  680.    For i = intLB To intUB
  681.       List2.AddItem "" & array(i)
  682.    Next i
  683.    DoEvents
  684.    List2.Clear
  685.    intResult = cArrayOnDisk("c:\test.dat", array(), GET_ARRAY_ON_DISK)
  686.    strDisplay = strDisplay & "Load from disk to this integer array is '" & intResult & "'"
  687.    For i = intLB To intUB
  688.       List2.AddItem "" & array(i)
  689.    Next i
  690.    lbl_Result = strDisplay
  691.    'time the function
  692.    TimerHandle = cTimerOpen()
  693.    TimerStartOk = cTimerStart(TimerHandle)
  694.    For i = 1 To Iteration
  695.       intResult = cArrayOnDisk("c:\test.dat", array(), GET_ARRAY_ON_DISK)
  696.    Next i
  697.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  698.    TimerCloseOk = cTimerClose(TimerHandle)
  699. End Sub
  700. Private Sub TestMaxNotX()
  701.    Dim intResult        As Integer
  702.    Dim strDisplay       As String
  703.    Dim intLB            As Integer
  704.    Dim intUB            As Integer
  705.    Dim intTotalElement  As Integer
  706.    Dim i                As Integer
  707.    intResult = False
  708.    strDisplay = ""
  709.    ReDim array(arrSize) As Integer
  710.    Randomize Timer
  711.    intLB = LBound(array)
  712.    intUB = UBound(array)
  713.    intTotalElement = intUB - intLB + 1
  714.       
  715.    For i = intLB To intUB
  716.       array(i) = RandI * Rnd(1)
  717.       List1.AddItem "" & array(i)
  718.    Next i
  719.    intResult = cSortI(array())
  720.    For i = intLB To intUB
  721.       List2.AddItem "" & array(i)
  722.    Next i
  723.    intResult = cMaxI(array())
  724.    strDisplay = strDisplay & "The Max of this integer array is : " & intResult & vbCrLf & vbCrLf
  725.    strDisplay = strDisplay & "The MaxNotX '" & intResult & "' of this integer array is : " & cMaxNotXI(array(), intResult)
  726.    lbl_Result = strDisplay
  727.    'time the function
  728.    TimerHandle = cTimerOpen()
  729.    TimerStartOk = cTimerStart(TimerHandle)
  730.    For i = 1 To Iteration
  731.       intResult = cMaxNotXI(array(), intResult)
  732.    Next i
  733.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  734.    TimerCloseOk = cTimerClose(TimerHandle)
  735. End Sub
  736. Public Sub TestMinNotX()
  737.    Dim intResult        As Integer
  738.    Dim strDisplay       As String
  739.    Dim intLB            As Integer
  740.    Dim intUB            As Integer
  741.    Dim intTotalElement  As Integer
  742.    Dim i                As Integer
  743.    intResult = False
  744.    strDisplay = ""
  745.    ReDim array(arrSize) As Integer
  746.    Randomize Timer
  747.    intLB = LBound(array)
  748.    intUB = UBound(array)
  749.    intTotalElement = intUB - intLB + 1
  750.       
  751.    For i = intLB To intUB
  752.       array(i) = RandI * Rnd(1)
  753.       List1.AddItem "" & array(i)
  754.    Next i
  755.    intResult = cSortI(array())
  756.    For i = intLB To intUB
  757.       List2.AddItem "" & array(i)
  758.    Next i
  759.    intResult = cMinI(array())
  760.    strDisplay = strDisplay & "The Min of this integer array is : " & intResult & vbCrLf & vbCrLf
  761.    strDisplay = strDisplay & "The MinNotX '" & intResult & "' of this integer array is : " & cMinNotXI(array(), intResult)
  762.    lbl_Result = strDisplay
  763.    'time the function
  764.    TimerHandle = cTimerOpen()
  765.    TimerStartOk = cTimerStart(TimerHandle)
  766.    For i = 1 To Iteration
  767.       intResult = cMinNotXI(array(), intResult)
  768.    Next i
  769.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  770.    TimerCloseOk = cTimerClose(TimerHandle)
  771. End Sub
  772.